{% extends 'base.html' %}
{% load staticfiles %}
{% block title %}爱链{% endblock %}
{% block content %}

    {% if username %}
{#        search#}
        <div class="search-form container-fluid">
            <form class="form-horizontal search-from" method="post">
                {% csrf_token %}
                <div class="form-group">
                    <label for="classify-code">URL分类</label>
                    <select class="classify-code input-sm" name="type-code">
                    </select>

                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<label for="url-name" class="input-group-sm">地址名称：</label>
                    <input type="text" class="input-group-sm url-name  input-sm" name="url-name" placeholder="请输入地址名称">
                    <button type="button" class="btn-sm btn-primary search" onclick="getUrls('post')">查询</button>

                </div>

            </form>

        </div>

        <div class="loader">loading...</div>
        <div class="row">


        </div>

        <div class="modal fade" id="addurl" tabindex="-1" role="dialog" aria-labelledby="modaltitle">
            <div class="modal-dialog" role="document">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
                                aria-hidden="true">&times;</span></button>
                        <h4 class="modal-title" id="modaltitle">增加URL</h4>
                    </div>
                    <div class="modal-body" style="padding-left: 10%">
                        <form class="form-inline form-group-lg add-from">{% csrf_token %}
                            <div>
                                <label for="url-link">URL地址:</label>
                                <input type="url" class="url-link input-sm" name="urllink" placeholder=" 请输入URL地址"
                                       required maxlength="200" style="width: 70%">
                            </div>
                            <div>
                                <label for="url-name">URL名称:</label>
                                <input type="url" class="url-name input-sm" name="urlname" placeholder=" 请输入地址名称"
                                       required maxlength="100" style="width: 70%">
                            </div>
                            <div>
                                <label for="url-type">URL分类:</label>
                                <select required class="input-sm url-type" name="urltype" style="width: 70%">
                                    <option value="">请选择</option>
                                </select>
                                <button  type="button" class="btn-sm btn-primary add-url" data-toggle="modal" data-target="#addclassify">+</button>
                            </div>
                            <div>
                                <label for="remark">备&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp注:</label>
                                <textarea class="remark input-sm" name="remark" placeholder=" 请输入备注" rows="7"
                                          style="width: 70%" maxlength="500"></textarea>
                            </div>
                        </form>
                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                        <button type="button" class="btn btn-primary add-url-btn" onclick="addUrl()">提交</button>
                    </div>
                </div>
            </div>
        </div>

        <div class="modal fade" id="addclassify" tabindex="-1" role="dialog" aria-labelledby="modaltitle">
            <div class="modal-dialog" role="document">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
                                aria-hidden="true">&times;</span></button>
                        <h4 class="modal-title" id="modaltitle">增加地址分类</h4>
                    </div>
                    <div class="modal-body" style="padding-left: 10%">
                        <form class="form-inline form-group-lg add-from">{% csrf_token %}
                            <div>
                                <label for="type-name">分类名称:</label>
                                <input type="url" class="type-name input-sm" name="typename" placeholder=" 请输入URL分类名称"
                                       required maxlength="40" style="width: 70%">
                            </div>
                        </form>
                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                        <button type="button" class="btn btn-primary add-classify-btn" onclick="addClassify()">提交
                        </button>
                    </div>
                </div>
            </div>
        </div>

        <div class="right-bar">
            <div>
                <button type="button" class="btn-sm btn-primary add-url" data-toggle="modal" data-target="#addurl">
                    增加URL
                </button>
            </div>
            <div class="return-top">
                <img src="{% static 'icon/top.png' %}" class="back-to-top-img">

            </div>

        </div>
    {% else %}
        <h3>您尚未登陆系统，点此<a href="/accounts/login/">登陆</a> </h3>
    {% endif %}


    <script type="text/javascript" src="{% static 'bootstrap/js/favurls.js' %}"></script>



{% endblock %}
